/**
 * @name Test001
 * @author wxd
 * @desc
 * @date
 */

import React, { Component } from "react"
import { inject, observer } from "mobx-react"
import { Button } from "antd"
//注入store模块
@inject("counter")
//监听 转变响应式页面
@observer
class Test001 extends Component {
  state = {
    id: this.props.location.state.id ? this.props.location.state.id : "000"
  }
  componentDidMount() {
    this.counters()
  }
  counters = v => {
    console.log("vvvv---", v)
    const params = {
      orgId: 1,
      pageNumber: 1,
      pageSize: v ? v : 1000
    }
    this.props.counter.testData(params)
  }
  render() {
    const { count } = this.props.counter
    return (
      <div>
        <h1>test001</h1>
        <p />
        <Button type="primary" onClick={this.counters.bind(this, 1)}>
          动态加载
        </Button>
        <p />
        {this.state.id}
        <p />
        {count.map(v => (
          <span key={v.userId}>{v.name}</span>
        ))}
      </div>
    )
  }
}

export default Test001
